; The CMD file.
;
; Two parts: 1. Command definition and  2. State entry
; (state entry is after the commands def section)
;
; 1. Command definition
; ---------------------
;-| Button Remapping |-----------------------------------------------------
; This section lets you remap the player's buttons (to easily change the
; button configuration). The format is:
;   old_button = new_button
; If new_button is left blank, the button cannot be pressed.
[Remap]
x = x
y = y
z = z
a = a
b = b
c = c
s = s

;-| Default Values |-------------------------------------------------------
[Defaults]
; Default value for the "time" parameter of a Command. Minimum 1.
command.time = 15

; Default value for the "buffer.time" parameter of a Command. Minimum 1,
; maximum 30.
command.buffer.time = 1

;-| Single Button |---------------------------------------------------------
[Command]
name = "a"
command = a
time = 1

[Command]
name = "b"
command = b
time = 1

[Command]
name = "c"
command = c
time = 1

[Command]
name = "x"
command = x
time = 1

[Command]
name = "y"
command = y
time = 1

[Command]
name = "z"
command = z
time = 1

[Command]
name = "start"
command = s
time = 1

;-| Hold Dir |--------------------------------------------------------------
[Command]
name = "holdfwd";Required (do not remove)
command = /$F
time = 1

[Command]
name = "holdback";Required (do not remove)
command = /$B
time = 1

[Command]
name = "holdup" ;Required (do not remove)
command = /$U
time = 1

[Command]
name = "holddown";Required (do not remove)
command = /$D
time = 1

;-| CPU |--------------------------------------------------------------

[Command]
name = "cpu0"
command = B+D+F+U,~U,~32222U,a+b+c+x+y+z+s
time = -2

[Command]
name = "cpu1"
command = B+D+F+U,~U,~32222U,a+b+c+x+y+z+s
time = -2

[Command]
name = "cpu2"
command = B+D+F+U,~U,~32222U,a+b+c+x+y+z+s
time = -2

[Command]
name = "cpu3"
command = B+D+F+U,~U,~32222U,a+b+c+x+y+z+s
time = -2

[Command]
name = "cpu4"
command = B+D+F+U,~U,~32222U,a+b+c+x+y+z+s
time = -2

[Command]
name = "cpu5"
command = B+D+F+U,~U,~32222U,a+b+c+x+y+z+s
time = -2

[Command]
name = "cpu6"
command = B+D+F+U,~U,~32222U,a+b+c+x+y+z+s
time = -2

[Command]
name = "cpu7"
command = B+D+F+U,~U,~32222U,a+b+c+x+y+z+s
time = -2

[Command]
name = "cpu8"
command = B+D+F+U,~U,~32222U,a+b+c+x+y+z+s
time = -2

[Command]
name = "cpu9"
command = B+D+F+U,~U,~32222U,a+b+c+x+y+z+s
time = -2

;-| Double Tap |-----------------------------------------------------------
[Command]
name = "FF"     ;Required (do not remove)
command = F, F
time = 10

[Command]
name = "BB"     ;Required (do not remove)
command = B, B
time = 10

;-| 2/3 Button Combination |-----------------------------------------------
[Command]
name = "recovery";Required (do not remove)
command = x+y
time = 1

;-| Dir + Button |---------------------------------------------------------
[Command]
name = "down_a"
command = /$D,a
time = 1

[Command]
name = "down_b"
command = /$D,b
time = 1


;---------------------------------------------------------------------------
; 2. State entry
; --------------
; This is where you define what commands bring you to what states.
;
; Don't remove the following line. It's required by the CMD standard.
[Statedef -1]

[State -1, AI Helper Check]
type = ChangeState
trigger1 = IsHelper(9741)
value = 9741

[State -1, AI Helper Check 2]
type = ChangeState
trigger1 = IsHelper(9742)
value = 9742

[State -1, WideOpen]
type = AssertSpecial
trigger1 = 1
flag = NoStandGuard
flag2 = NoCrouchGuard
flag3 = NoAirGuard

[State -1, Ko Slow off]
type = AssertSpecial
trigger1 = 1
flag = nokoslow

[State -1, WideOpen]
type = AssertSpecial
trigger1 = 1
flag = NoWalk
flag2 = noautoturn
flag3 = unguardable
ignorehitpause = 1
ignorepause = 1


[State -1, Reset]
type = SelfState
trigger1 = IsHelper(44304)
trigger1 = StateNo != [44304,44305]
value = 44304
IgnoreHitPause = 1

[State -1, Hide]
type = AssertSpecial
trigger1 = IsHelper(44304)
flag = invisible
flag2 = NoShadow
IgnoreHitPause = 1

[State -1, GO]
type = DestroySelf
trigger1 = IsHelper
trigger1 = movereversed = 1

[State -1, No time over]
type = AssertSpecial
trigger1 = 1
flag = timerfreeze

;===========================================================================
;---------------------------------------------------------------------------
;Jump Air Dash
[State -1, Jump Air Dash]
type = ChangeState
value = 230
triggerall = var(0) != 1
triggerall = var(22) = 0
triggerall = command = "x"
trigger1 = statetype = S
trigger1 = ctrl = 1

[State -1, Spin Smash]
type = ChangeState
value = 1300
triggerall = var(0) != 1
triggerall = var(32) <= 2
triggerall = var(22) = 1 && life > 100
triggerall = command = "c"
trigger1 = statetype = S
trigger1 = stateno = 0

;---------------------------------------------------------------------------
;Spin Attack Ground Bounce
[State -1, Spin Attack Ground Bounce]
type = ChangeState
value = 200
triggerall = var(0) != 1
triggerall = var(22) = 0
triggerall = command = "a"
trigger1 = statetype = S
trigger1 = ctrl = 1

[State -1, Energy Blasts]
type = ChangeState
value = 1000
triggerall = var(0) != 1
triggerall = var(22) = 1 && life > 100
triggerall = command = "a" || statetime > 800
trigger1 = statetype = S
trigger1 = stateno = 0

;---------------------------------------------------------------------------
;Spin Attack Ground Dash
;LbN
[State -1, Spin Attack Ground Dash]
type = ChangeState
value = 220
triggerall = var(0) != 1
triggerall = var(22) = 0
triggerall = command = "b"
trigger1 = statetype = S
trigger1 = ctrl = 1

;Diving Attack
[State -1, Diving Attack]
type = ChangeState
value = 1200
triggerall = var(0) != 1
triggerall = var(32) <= 2
triggerall = var(22) = 1 && life > 100
triggerall = command = "b" 
trigger1 = statetype = S 
trigger1 = stateno = 0

;---------------------------------------------------------------------------
;Explod Attack
[State -1, Explod Attack]
type = ChangeState
value = 1500
triggerall = var(0) != 1
triggerall = var(22) = 1 && life <= 100
triggerall = command = "x" || statetime > 800
trigger1 = statetype = S
trigger1 = stateno = 0


;---------------------------------------------------------------------------
;===========================================================================
;Random
;---------------------------------------------------------------------------

[State -1, AI Punch 1 condition Check]
type = VarRandom
trigger1 = 1
v = 31
range = 1,4

[State -1, AI Punch 1 condition Check]
type = VarSet
trigger1 = movetype = A
var(31) = 0

;---------------------------------------------------------------------------

[State -1, Energy Blasts]
type = ChangeState
value = 1000
triggerall = random <= ifelse(var(32) > 2,500,100)
triggerall = var(22) = 1 && life > 100
triggerall = var(0) = 1
trigger1 = statetype = S
trigger1 = stateno = 0
trigger1 = var(31) = 2
trigger1 = statetime >= ifelse(random <=  500,500,400) || random < 30 && statetime > 150

;Explod Attack
[State -1, Explod Attack]
type = ChangeState
value = 1500
triggerall = var(22) = 1 && life <= 100
triggerall = var(0) = 1
trigger1 = statetype = S
trigger1 = stateno = 0
trigger1 = statetime >= ifelse(random <=  500,500,400) || random < 30 && statetime > 150

[State -1, Jump Air Dash]
type = ChangeState
value = 230
triggerall = var(22) = 0
triggerall = var(0) = 1
trigger1 = statetype = S
trigger1 = ctrl = 1
trigger1 = var(31) = 1
trigger1 = statetime > 30 || NumHelper(870) && random < 300

[State -1, Spin Smash]
type = ChangeState
value = 1300
triggerall = var(32) <= 2
triggerall = var(22) = 1 && life > 100
triggerall = var(0) = 1
trigger1 = statetype = S
trigger1 = stateno = 0
trigger1 = var(31) = 1
trigger1 = statetime >= ifelse(random <=  500,500,400) || random < 30 && statetime > 150

;---------------------------------------------------------------------------
;Spin Attack Ground Bounce
[State -1, Spin Attack Ground Bounce]
type = ChangeState
value = 200
triggerall = var(22) = 0
triggerall = var(0) = 1
trigger1 = statetype = S
trigger1 = ctrl = 1
trigger1 = var(31) = 2
trigger1 = statetime > 30 || NumHelper(870) && random < 300


[State -1, Spin Attack Ground Dash]
type = ChangeState
value = 220
triggerall = var(22) = 0
triggerall = var(0) = 1
trigger1 = statetype = S
trigger1 = ctrl = 1
trigger1 = var(31) = 3
trigger1 = statetime > 30 || NumHelper(870) && random < 300

;Diving Attack
[State -1, Diving Attack]
type = ChangeState
value = 1200
triggerall = var(32) <= 2
triggerall = var(22) = 1 && life > 100
triggerall = var(0) = 1
trigger1 = statetype = S
trigger1 = stateno = 0
trigger1 = var(31) = 3
trigger1 = statetime >= ifelse(random <=  500,500,400) || random < 30 && statetime > 150




